<?php
	if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	class Mmod_salarypara extends MYAD_Model{
		protected $table_name = 'm_salaryparameter';
        function __construct(){
			parent::__construct();
		}
                /**
     * @author Thanh NV        
     * @function isApplyDate 
     * @param: $date        
     * Output: TRUE or FALSE
     * @This function return TRUE or FALSE
     */ 
                
        function isApplyDate($date){
            $query = $this->db->get_where('m_salaryparameter', array('ApplyDate' => $date));
            if($query->num_rows()>0){
                return false;
            }else{
                return true;
            }
        }
        
        /**
     * @author Thanh NV        
     * @function checkApplyDate 
     * @param: date,id          
     * Output: TRUE or FALSE
     * @This function return TRUE or FALSE
     */ 
        function checkApplyDate($date,$id){
            $result=false;            
            $query = $this->db->get_where('m_salaryparameter', array('ApplyDate' => $date));
            if($query->num_rows()>0){
                $result= false;
            }else{
                $result= true;
            }            
            //
            $query = $this->db->get_where('m_salaryparameter', array('ApplyDate' => $date,'Id'=>$id));
            if($query->num_rows()>0){
                $result= true;            
            }            
            return $result;
        }
}       
        
?>